﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FDEE.Model
{
    public class FPME41 : FootingBase
    {
        /// <summary>
        /// FPME41构造函数
        /// </summary>
        /// <param name="typeName"></param>
        /// <param name="pierNumber"></param>
        /// <param name="subType"></param>
        public FPME41(EFootingType _ePCType, string typeName, string pierNumber, eSubType subType, int Height, int Length, int Width)
            : base(_ePCType,typeName, pierNumber, subType,  Width, Length, Height)
        {
            //SetConcreteVolume();
            //SetRebarList();
            //SetConcreteClass();
        }

        public override void SetRebarList()
        {
            RebarList = new RebarCollection();

            #region 主筋
            // N1a
            if (SubType == eSubType.A)
            {
                RebarList.Add(new MIRebarRecord(1, 0, "", eDB.DB32, Length, 75,
                        Height - 100 - 75 - 16 - 500 + 400, 45, eShapeType.MI));
            }
            else
            {
                RebarList.Add(new MIRebarRecord(1, 0, "a", eDB.DB32, Length, 75,
                    Height - 100 - 75 - 16 - 500 + 400, 30, eShapeType.MI));
            }
            //N1b
            if (SubType != eSubType.A)
            {
                if (SubType == eSubType.B)
                {
                    RebarList.Add(new MARebarRecord(1, 0, "b", eDB.DB25, Length - 75 * 2 - 16 * 2 - 32 * 2, 0, 0, 0, 30, eShapeType.MA));
                }
                else if (SubType == eSubType.C)
                {
                    RebarList.Add(new MARebarRecord(1, 0, "b", eDB.DB25, Length - 75 * 2 - 16 * 2 - 32 * 2, 0, 0, 0, 36, eShapeType.MA));
                }
                else
                {
                    RebarList.Add(new MARebarRecord(1, 0, "b", eDB.DB28, Length - 75 * 2 - 16 * 2 - 32 * 2, 0, 0, 0, 30, eShapeType.MA));
                }
            }

            // N2/N3/N4
            RebarList.Add(new MIRebarRecord(2, 0, "", eDB.DB28, Width, 75 + 16,
                Height - 100 - 32 - 75 - 16 - 500 + 400, 47, eShapeType.MI));

            RebarList.Add(new MIRebarRecord(3, 0, "", eDB.DB16, Length, 75, 500, 15, eShapeType.MI));
            RebarList.Add(new MIRebarRecord(4, 0, "", eDB.DB16, Width, 75, 500, 23, eShapeType.MI));
            #endregion

            #region 起步钢筋
            if (true)
            {
                RebarList.Add(new MHXRebarRecord(8, 7, "", eDB.DB32, false, 4 * 2, eShapeType.MHXe));
                RebarList.Add(new MHXRebarRecord(8, 1, "", eDB.DB32, false, 11 * 4, eShapeType.MHXe));
                RebarList.Add(new MHXRebarRecord(8, 2, "", eDB.DB32, false, 19 * 2, eShapeType.MHXe));
                RebarList.Add(new MHXRebarRecord(8, 3, "", eDB.DB32, true, 32, eShapeType.MHXi));
                RebarList.Add(new MHXRebarRecord(8, 4, "", eDB.DB32, false, 2 * 2, eShapeType.MHXe));
            }
            else
            {
                throw new NotImplementedException();
            }


            #endregion


        }
    }


    public class FPME42 : FootingBase
    {


        eSubType SubType;

        /// <summary>
        /// FPME42构造函数
        /// </summary>
        /// <param name="typeName"></param>
        /// <param name="pierNumber"></param>
        /// <param name="subType"></param>
        public FPME42(EFootingType _ePCType, string typeName, string pierNumber, eSubType subType,int Height, int Length, int Width)
            : base(_ePCType,typeName, pierNumber, subType,Width, Length, Height)
        {
            //SetConcreteVolume();
            //SetRebarList();
            //SetConcreteClass();
        }
               
        public override void SetRebarList()
        {
            RebarList = new RebarCollection();
            int diaOfN1;
            // N1 N2
            if (SubType == eSubType.A)
            {
                diaOfN1 = 28;
                RebarList.Add(new MIRebarRecord(1, 0, "", eDB.DB28, Length, 75,
                        Height - 100 - 75 - 16 - 500 + 400,
                        RebarArrangement.EqualArr(Width - 75 * 2 - 28, 100), eShapeType.MI));

                RebarList.Add(new MIRebarRecord(2, 0, "", eDB.DB28, Width, 75,
                    Height - 100 - diaOfN1 - 75 - 16 - 500 + 400,
                    RebarArrangement.EqualArr(Length - 75 * 2 - diaOfN1 * 2 - 28, 125), eShapeType.MI));

            }
            else if (SubType == eSubType.B)
            {
                diaOfN1 = 32;
                RebarList.Add(new MIRebarRecord(1, 0, "", eDB.DB32, Length, 75,
                        Height - 100 - 75 - 16 - 500 + 400,
                        RebarArrangement.EqualArr(Width - 75 * 2 - 32, 125), eShapeType.MI));
                RebarList.Add(new MIRebarRecord(2, 0, "", eDB.DB28, Width, 75,
                    Height - 100 - diaOfN1 - 75 - 16 - 500 + 400,
                    RebarArrangement.EqualArr(Length - 75 * 2 - diaOfN1 * 2 - 28, 100), eShapeType.MI));

            }
            else if (SubType == eSubType.C)
            {
                diaOfN1 = 32;
                RebarList.Add(new MIRebarRecord(1, 0, "", eDB.DB32, Length, 75,
                        Height - 100 - 75 - 16 - 500 + 400,
                        RebarArrangement.EqualArr(Width - 75 * 2 - 32, 100), eShapeType.MI));
                RebarList.Add(new MIRebarRecord(2, 0, "", eDB.DB28, Width, 75,
                    Height - 100 - diaOfN1 - 75 - 16 - 500 + 400,
                    RebarArrangement.EqualArr(Length - 75 * 2 - diaOfN1 * 2 - 28, 100), eShapeType.MI));
            }

            else
            {
                diaOfN1 = 32;
                RebarList.Add(new MIRebarRecord(1, 0, "", eDB.DB32, Length, 75,
                        Height - 100 - 75 - 16 - 500 + 400,
                        RebarArrangement.EqualArr(Width - 75 * 2 - 32, 100), eShapeType.MI));
                RebarList.Add(new MIRebarRecord(2, 0, "", eDB.DB32, Width, 75,
                    Height - 100 - diaOfN1 - 75 - 16 - 500 + 400,
                    RebarArrangement.EqualArr(Length - 75 * 2 - diaOfN1 * 2 - 32, 125), eShapeType.MI));
            }

            //N3/N4
            RebarList.Add(new MIRebarRecord(3, 0, "", eDB.DB16, Length, 75, 500,
                RebarArrangement.EqualArr(Width - 75 * 2, 300), eShapeType.MI));
            RebarList.Add(new MIRebarRecord(4, 0, "", eDB.DB16, Width, 75, 500,
                RebarArrangement.EqualArr(Width - 75 * 2, 300), eShapeType.MI));

            #region 起步钢筋
            if (true)
            {

                RebarList.Add(new MHXRebarRecord(6, 1, "", eDB.DB32, false, 15 * 2, eShapeType.MHXe));
                RebarList.Add(new MHXRebarRecord(6, 2, "", eDB.DB32, false, 12 * 2, eShapeType.MHXe));
                RebarList.Add(new MHXRebarRecord(6, 3, "", eDB.DB32, true, 10 * 2, eShapeType.MHXi));
                RebarList.Add(new MHXRebarRecord(6, 4, "", eDB.DB32, true, 26, eShapeType.MHXi));
                RebarList.Add(new MHXRebarRecord(6, 5, "", eDB.DB32, false, 4 * 2, eShapeType.MHXe));
            }
            else
            {
                // 未完成
                throw new NotImplementedException();
            }



            #endregion
        }

    }






    //public class PME41C : MemberBase
    //{
    //    int Height = 2000;  //承台高度
    //    int Length = 7000;  //承台长度(横）
    //    int Width = 4500;   //承台宽度(顺）
    //    List<int> Cover = new List<int> { 75, 100, 150 }; //保护层厚度
    //    string Footname;
    //    int r, A1a, A1b, A2, A3, A4, A5, vol;
    //    int B1a, B1b, B2, B3, B4, B5;
    //    int C1a, C1b, C2, C3, C4, C5;
    //    int n1a, r1a, d1a, q1a, sp1a, n2, r2, d2, q2, sp2;
    //    int n1b, r1b, d1b, q1b, sp1b, n3, r3, d3, q3, sp3;
    //    int n4, r4, d4, q4, sp4;
    //    int r5, d5, q5;
    //    int r8, d8, q8a, q8b, q8c;
    //    int r7, d7, q7;
    //    double angle;

    //    public PME41C(string typeName, string pierNum, string footname) : base(typeName, pierNum)
    //    {

    //        Footname = footname;

    //        //1号钢筋, MI方式，A-主筋长度外侧-外侧，弯钩长度固定500，DB32；
    //        A1a = Length - 2 * Cover[0];
    //        B1a = Height - 2 * Cover[0] - 2 * Cover[1] - 500 + 400;
    //        C1a = B1a;
    //        A1b = Length - 2 * Cover[0] - 2 * Convert.ToInt32(eDB.DB32) - 2 * Convert.ToInt32(eDB.DB16);
    //        B1b = Height - 2 * Cover[0] - 2 * Cover[1] - 500 + 400;
    //        C1b = B1b;
    //        r1a = (int)GlobalFuncs.GetR(eDB.DB32, 90);
    //        r1b = (int)GlobalFuncs.GetR(eDB.DB25, 90);
    //        d1a = Convert.ToInt32(eDB.DB32);
    //        d1b = Convert.ToInt32(eDB.DB25);
    //        sp1a = 150;
    //        q1a = (int)Math.Round((double)((Length - 2 * Cover[0]) / sp1a), 0, MidpointRounding.AwayFromZero) + 1;
    //        sp1b = 125;
    //        q1b = (int)Math.Round((double)((Length - 2 * Cover[0]) / sp1b), 0, MidpointRounding.AwayFromZero) + 1;
    //        //2号钢筋，MI方式，DB28;
    //        A2 = Width - 2 * Cover[0];
    //        C2 = Height - 2 * Cover[0] - 2 * Cover[1] - 500 + 400;
    //        r2 = (int)GlobalFuncs.GetR(eDB.DB28, 90);
    //        d2 = Convert.ToInt32(eDB.DB28);
    //        sp2 = 150;
    //        q2 = (int)Math.Round((double)((Width - 2 * Cover[0]) / sp2), 0, MidpointRounding.AwayFromZero) + 1;
    //        //3号钢筋，MG方式，DB16;
    //        A3 = Length - 2 * Cover[2];
    //        n3 = 500;
    //        r3 = (int)GlobalFuncs.GetR(eDB.DB16, 90);
    //        d3 = Convert.ToInt32(eDB.DB16);
    //        sp3 = 300;
    //        q3 = (int)Math.Round((double)((Length - 2 * Cover[2]) / sp3), 0, MidpointRounding.AwayFromZero) + 1;

    //        //4号钢筋，MG方式，DB16;
    //        A4 = Width - 2 * Cover[2];
    //        n4 = 500;
    //        r4 = (int)GlobalFuncs.GetR(eDB.DB16, 90);
    //        d4 = Convert.ToInt32(eDB.DB16);
    //        sp4 = 300;
    //        q4 = (int)Math.Round((double)((Width - 2 * Cover[2]) / sp4), 0, MidpointRounding.AwayFromZero) + 1;

    //        //5号钢筋，MI方式，DB16,注意ABC具体含义与1-4钢筋有区别；
    //        A5 = 4213;
    //        B5 = Width - 2 * Cover[0] - 2 * d2;
    //        C5 = 3573;
    //        r5 = (int)GlobalFuncs.GetR(eDB.DB16, 90);
    //        d5 = Convert.ToInt32(eDB.DB16);
    //        q5 = 3;

    //        //7、8号钢筋，MHX方式，预埋承台内的墩身主筋。长度固定9m
    //        r8 = (int)GlobalFuncs.GetR(eDB.DB32, 90);
    //        d8 = Convert.ToInt32(eDB.DB32);
    //        q8a = 21 * 2; //
    //        q8b = 20 * 2;
    //        q8c = 20 * 2;
    //        q7 = 4;


    //    }

    //    public override void SetConcreteVolume()
    //    {
    //        //混凝土体积
    //        vol = (int)Math.Round((double)Length * Width * Height, 3, MidpointRounding.AwayFromZero);
    //    }

    //    public override void SetRebarList()
    //    {
    //        RebarList.Add(new MIRebarRecord(1, 0, "a", eDB.DB32, A1a, B1a, C1a, r1a, d1a, q1a, eShapeType.MI));
    //        RebarList.Add(new MIRebarRecord(1, 0, "b", eDB.DB25, A1b, B1b, C1b, r1b, d1b, q1b, eShapeType.MI));
    //        RebarList.Add(new MIRebarRecord(2, 0, "", eDB.DB28, A2, B2, C2, r2, d2, q2, eShapeType.MI));
    //        RebarList.Add(new MGRebarRecord(3, 0, "", eDB.DB16, A3, n3, r3, d3, q3, eShapeType.MG));
    //        RebarList.Add(new MGRebarRecord(4, 0, "", eDB.DB16, A4, n4, r4, d4, q4, eShapeType.MG));

    //        RebarList.Add(new MIRebarRecord(5, 1, "", eDB.DB16, A5, B5, C5, r5, d5, q5, eShapeType.MI));
    //        RebarList.Add(new MIRebarRecord(5, 1, "", eDB.DB16, A5, B5, C5, r5, d5, q5, eShapeType.MI));

    //        RebarList.Add(new MHXRebarRecord(7, 0, "", eDB.DB32, r8, d8, q7, eShapeType.MHX));
    //        RebarList.Add(new MHXRebarRecord(8, 1, "", eDB.DB32, r8, d8, q8a, eShapeType.MHX));
    //        RebarList.Add(new MHXRebarRecord(8, 2, "", eDB.DB32, r8, d8, q8b, eShapeType.MHX));
    //        RebarList.Add(new MHXRebarRecord(8, 3, "", eDB.DB32, r8, d8, q8c, eShapeType.MHX));

    //    }
    //    public override void SetTendonList()
    //    {
    //    }

    //    public override void SetConcreteClass()
    //    {
    //        ConcreteClass = eConcreteClass.C30;
    //    }

    //}
    //public class PME42C : MemberBase
    //{
    //    int Height = 1650;  //承台高度
    //    int Length = 5600;  //承台长度(横）
    //    int Width = 5600;   //承台宽度(顺）
    //    List<int> Cover = new List<int> { 75, 100, 150 }; //保护层厚度
    //    string Footname;
    //    int r, A1, A2, A3, A4, A5, vol;
    //    int B1, B2, C2, B3, B4, B5, C5;
    //    int C1, r1, d1, q1, sp1, n2, r2, d2, q2, sp2;
    //    int n3, r3, d3, q3, sp3;
    //    int n4, r4, d4, q4, sp4;
    //    int r5, d5, q5;
    //    int r8, d8, q8a, q8b, q8c;
    //    int r7, d7, q7;
    //    double angle;

    //    public PME42C(string typeName, string pierNum, string footname) : base(typeName, pierNum)
    //    {


    //        Footname = footname;

    //        //1号钢筋, MI方式，A-主筋长度外侧-外侧，弯钩长度固定500，DB32；
    //        A1 = Length - 2 * Cover[0];
    //        B1 = Height - 2 * Cover[0] - 2 * Cover[1] - 500 + 400;
    //        C1 = B1;
    //        r1 = (int)GlobalFuncs.GetR(eDB.DB32, 90);
    //        d1 = Convert.ToInt32(eDB.DB32);
    //        sp1 = 100;
    //        q1 = (int)Math.Round((double)((Length - 2 * Cover[0]) / sp1), 0, MidpointRounding.AwayFromZero) + 1;

    //        //2号钢筋，MI方式，DB28;
    //        A2 = Width - 2 * Cover[0];
    //        C2 = Height - 2 * Cover[0] - 2 * Cover[1] - 500 + 400;
    //        r2 = (int)GlobalFuncs.GetR(eDB.DB28, 90);
    //        d2 = Convert.ToInt32(eDB.DB28);
    //        sp2 = 100;
    //        q2 = (int)Math.Round((double)((Width - 2 * Cover[0]) / sp2), 0, MidpointRounding.AwayFromZero) + 1;

    //        //3号钢筋，MG方式，DB16;
    //        A3 = Length - 2 * Cover[2];
    //        n3 = 500;
    //        r3 = (int)GlobalFuncs.GetR(eDB.DB16, 90);
    //        d3 = Convert.ToInt32(eDB.DB16);
    //        sp3 = 300;
    //        q3 = (int)Math.Round((double)((Length - 2 * Cover[2]) / sp3), 0, MidpointRounding.AwayFromZero) + 1;

    //        //4号钢筋，MG方式，DB16;
    //        A4 = Width - 2 * Cover[2];
    //        n4 = 500;
    //        r4 = (int)GlobalFuncs.GetR(eDB.DB16, 90);
    //        d4 = Convert.ToInt32(eDB.DB16);
    //        sp4 = 300;
    //        q4 = (int)Math.Round((double)((Width - 2 * Cover[2]) / sp4), 0, MidpointRounding.AwayFromZero) + 1;

    //        //5号钢筋，MI方式，DB16,注意ABC具体含义与1-4钢筋有区别；
    //        A5 = 4213;
    //        B5 = Width - 2 * Cover[0] - 2 * d2;
    //        C5 = 3573;
    //        r5 = (int)GlobalFuncs.GetR(eDB.DB16, 90);
    //        d5 = Convert.ToInt32(eDB.DB16);
    //        q5 = 3;

    //        //7、8号钢筋，MHX方式，预埋承台内的墩身主筋。长度固定9m
    //        r8 = (int)GlobalFuncs.GetR(eDB.DB32, 90);
    //        d8 = Convert.ToInt32(eDB.DB32);
    //        q8a = 21 * 2; //
    //        q8b = 20 * 2;
    //        q8c = 20 * 2;
    //        q7 = 4;


    //    }

    //    public override void SetConcreteVolume()
    //    {
    //        //混凝土体积
    //        vol = (int)Math.Round((double)Length * Width * Height, 3, MidpointRounding.AwayFromZero);
    //    }

    //    public override void SetRebarList()
    //    {
    //        RebarList.Add(new MIRebarRecord(1, 0, "", eDB.DB32, A1, B1, C1, r1, d1, q1, eShapeType.MG));
    //        RebarList.Add(new MIRebarRecord(2, 0, "", eDB.DB28, A2, B2, C2, r2, d2, q2, eShapeType.MG));
    //        RebarList.Add(new MGRebarRecord(3, 0, "", eDB.DB16, A3, n3, r3, d3, q3, eShapeType.MG));
    //        RebarList.Add(new MGRebarRecord(4, 0, "", eDB.DB16, A4, n4, r4, d4, q4, eShapeType.MG));

    //        RebarList.Add(new MIRebarRecord(5, 1, "", eDB.DB16, A5, B5, C5, r5, d5, q5, eShapeType.MI));
    //        RebarList.Add(new MIRebarRecord(5, 1, "", eDB.DB16, A5, B5, C5, r5, d5, q5, eShapeType.MI));

    //        RebarList.Add(new MHXRebarRecord(7, 0, "", eDB.DB32, r8, d8, q7, eShapeType.MHX));
    //        RebarList.Add(new MHXRebarRecord(8, 1, "", eDB.DB32, r8, d8, q8a, eShapeType.MHX));
    //        RebarList.Add(new MHXRebarRecord(8, 2, "", eDB.DB32, r8, d8, q8b, eShapeType.MHX));
    //        RebarList.Add(new MHXRebarRecord(8, 3, "", eDB.DB32, r8, d8, q8c, eShapeType.MHX));

    //    }
    //    public override void SetTendonList()
    //    {
    //    }

    //    public override void SetConcreteClass()
    //    {
    //        ConcreteClass = eConcreteClass.C30;
    //    }

    //}
}
